/**
 * \file BeamWeapon.h
 * \author Niels van Galen Last & Erik Kok
 * \date 01-15-08
 */
#ifndef BEAM_WEAPON_H
#define BEAM_WEAPON_H

#include <iostream>

#include "Character.h"
#ifndef WIN32_LEAN_AND_MEAN
#include "OgreOde_Core/OgreOde_Core.h"
#else
#include "OgreOde_Core.h"
#endif

/**
 * BeamWeapon is the primary weapon for the player. It is triggered using
 * the SPACEBAR button. 
 * It creates a BillboardChain which 'flies' forward in the direction the
 * player is facing upon creation.
 */
class BeamWeapon  : public Character
{

public:
	/// Default constructor, currently not used.
	BeamWeapon() {}
	
	/// Overloaded constructor
	BeamWeapon(String mName, OgreOde::World *world );

	/// Default destructor
	~BeamWeapon() {}

	/// update
	void update(Real elapsedTime, OIS::Keyboard* input, OIS::Mouse* mouse);

	/// Creates a new beam and pushes it on the stack of bullets in play
	void create_beam();

	/// Updates a selected beam
	void update_beam();

	/**
	 * Set the position of a beam
	 * \param start The position where the beam starts
	 * \param translate A quaternion with all the direction information of the movement of the beam
	 */
	void set_position(Vector3 start, Quaternion translate);
	
	/**
	 * Get the current geometry
	 * \return mGeom A pointer to the Geometry
	 */
	OgreOde::Geometry* get_geometry() { return mGeom; }

	/**
	 * Returns the amount of updates which are applied to the bullets
	 * \return updates The updates
	 */
	int get_updates() const { return updates; }

	/// Sets an object to invisible when it is out of range
	void set_not_visible();

private:
	String mName;

	SceneNode* beam;
	Vector3 start;
	Quaternion translate;
    
	OgreOde::World     *mWorld;
    OgreOde::Body                   *mBody;
    OgreOde::Geometry               *mGeom;
	OgreOde::Space                  *mSpace;
	
	SceneManager* sceneMgr;

	BillboardChain* m_pBillboardChain;

	int updates;
};

#endif
